package com.atguigu.service.impl;

import com.atguigu.Dao.UserDao;
import com.atguigu.Dao.impl.UserDaoimpl;
import com.atguigu.pojo.User;
import com.atguigu.service.UserService;

public class Userserviceimpl implements UserService {
    private UserDao userDao=new UserDaoimpl() ;
    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
    return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existsUsername(String username) {
       if(userDao.queryUserByUsername(username)==null){
        return  false;
       }
        return true;
    }
}
